<%@page contentType="text/html;charset=UTF-8" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<%@page import="java.text.NumberFormat" %>
<%@page import="be.destin.skos.core.SkosManager" %>
<%@page import="be.destin.skos.html.SkosHtmlManager" %>
<%@page import="be.destin.skos.html.LocalError" %>
<%@page import="be.destin.skos.core.SchemeInterface" %>
<%@page import="be.destin.skos.core.SchemeUsage" %>
<%@page import="be.destin.skos.core.ConceptScheme" %>
<%@page import="be.destin.skos.core.Concept" %>
<%@page import="be.destin.skos.core.Term" %>
<%@page import="java.util.Map" %>
<%@page import="java.util.Map.Entry" %>
<%@page import="java.util.LinkedList" %>
<%@page import="java.util.TreeMap" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%	 
   SkosHtmlManager skosHtmlManager = SkosHtmlManager.getAskosiSessionInstance(request);
   SkosManager skosManager = skosHtmlManager.getSkosManager();
   String language = skosHtmlManager.getLanguage();
   String sort = request.getParameter("sort");
   String independant = request.getParameter("independant");
   String framing = request.getParameter("framed");
   boolean framed = framing != null && framing.equalsIgnoreCase("yes");
   if (independant != null && independant.equalsIgnoreCase("yes")) framed = false;
  %>
<%TreeMap<String,SchemeInterface> SortSchemes = new TreeMap<String,SchemeInterface>();
  NumberFormat nf=NumberFormat.getInstance(); // Get Instance of NumberFormat
  nf.setMinimumIntegerDigits(9);  // The minimum Digits required is 9
  nf.setMaximumIntegerDigits(9); // The maximum Digits required is 9
  for (SchemeInterface aScheme:skosManager.getConceptSchemes()) {
	if ("alfa".equals(sort)) {
     //SortSchemes.put(aScheme.getTitle(language),aScheme);
     SortSchemes.put(aScheme.getAbout(),aScheme);
	} else {
     //int total = ((ConceptScheme)aScheme).applicationUsageTotal();
     //SortSchemes.put(nf.format(999999999-total)+aScheme.getAbout(),aScheme);
	 SortSchemes.put(nf.format(999999999-aScheme.getSize())+aScheme.getAbout(),aScheme);
	}
  }
%>
<html>
<head>
<title><%=SortSchemes.size()%> concept schemes in <%=skosManager.getConfigDirectory()%></title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/askosi.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/ajaxtags.css" />
</head>
<body class="contentpage">
<% if (framed) {
%><script language="JavaScript">
parent.parent.parent.parent.focusFrame(this);
</script><%
} else {%>
 <h4><small><%
  if ("alfa".equals(sort)) { %>
 [alphabetical] <a href="toc.jsp">frequency</a>
  <% } else { %>
  <a href="toc.jsp?sort=alfa">alphabetical</a> [frequency]
  <% } %> sort</small><br/>
<img src="image/conceptscheme16.gif" border="0"/><%=SortSchemes.size()%> concept schemes registered:</h4>
<%
}%>
<ul>
<%
  for (SchemeInterface aScheme:SortSchemes.values()) {
     int total =((ConceptScheme)aScheme).applicationUsageTotal();
%><li style="list-style-image: url('image/conceptscheme16.gif');"><%--img src="image/conceptscheme16.gif" border="0"/--%>
<%if ("alfa".equals(sort)) {
%><tt><%=aScheme.getAbout()%></tt>: <%
} %>
   <big<% if (!framed) {%> style="border:solid 1px; padding:0px 5px 0px 5px;"<%}%>><a href="view.jsp?scheme=<%=aScheme.getAbout()%>&display=concepts<%if(framed){%>&framed=yes<%}%>#concepts" target="askosi_scheme"><%=aScheme.getSize()%></a> <a href="view.jsp?scheme=<%=aScheme.getAbout()%><%if(framed){%>&framed=yes<%}%>" target="askosi_scheme"><%=skosHtmlManager.toHtmlImage(aScheme.getIconAdapted(skosHtmlManager),aScheme.getAbout(),false)%><%=aScheme.getTitle(language)%></a></big>
<%if (! "alfa".equals(sort)) {
	if (framed) {%>: <%}
%><tt><%=aScheme.getAbout()%></tt> <%
} 
  if ( ! aScheme.getErrors().isEmpty()) {%>, <%=aScheme.getErrors().size()%> errors<%}
	  if (aScheme instanceof ConceptScheme) {
	    if ( ! ((ConceptScheme)aScheme).getInError().isEmpty()) {
		  %>, <a href="view.jsp?scheme=<%=aScheme.getAbout()%>&display=errors<%if(framed){%>&framed=yes<%}%>#errors" target="askosi_scheme"><img src="image/concepterror16.gif" border="0"/><%=((ConceptScheme)aScheme).getInError().size()%>
   		      concepts with errors</a><%
	    }
		if (((ConceptScheme)aScheme).isHierarchized()) {
		  %>, max.depth <span class="math">&#8615;</span><%=((ConceptScheme)aScheme).getMaxDepth()%><%
		}
		if (!framed) {
			%><ul class="nodisc"><%
			for (Concept anApplication: skosManager.getApplications().getAllConcepts()) {
				LinkedList<SchemeUsage> appUsages = ((ConceptScheme)aScheme).getUsage().getApplicationUsage(anApplication.getAbout());
				%><li><b><%=skosHtmlManager.toHtmlApplicationName(anApplication.getAbout(), (ConceptScheme)aScheme)%></b>: <%
				for (SchemeUsage dataRole: appUsages) {
					if (dataRole.getTotal() > 0) {
					%><%=skosHtmlManager.toHtmlRole(anApplication.getAbout(), dataRole.getRole(),(ConceptScheme)aScheme)%><a href="view.jsp?scheme=<%=aScheme.getAbout()%>&display=tops&application=<%=anApplication%>&role=<%=dataRole.getRole()%><%if(framed){%>&framed=yes<%}%>#tops" target="askosi_scheme"><%=dataRole.getTotal()%></a><% if (dataRole.isPropagated()) {%><img src="image/role/narrowertt16.gif" border="0"/><%}%>
					&nbsp; <%
					}
				} %></li><%
			}
			%></ul><br style="clear:both"/><%
		}
	  }
	  if (!framed) {
		%><hr noshade/><%
	  }
	%></li>
<%}%>
</ul>
<%if(!framed){%>
<%@include file="footer.jnc"%>
<%}%>
